home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / stv.lha / STV / ISA / carolina / notcrdpn.cls < prev    next >
Text File  |  1993-07-23  |  2KB  |  84 lines

  1.  
  2. SubPane subclass: #NoteCardPane
  3.   instanceVariableNames: 
  4.     'noteCardPane '
  5.   classVariableNames: ''
  6.   poolDictionaries: '' !
  7.  
  8. !NoteCardPane class methods !
  9.  
  10. example
  11.     " NoteCardPane example "
  12.     | myView |
  13. myView := self new.
  14. myView openOn: NoteCard new.! !
  15.  
  16.  
  17. !NoteCardPane methods !
  18.  
  19. defaultDispatcherClass 
  20.     "answer the default Dispatcher Class 
  21.     NoteCard Dispatcher" 
  22. ^NoteCardDispatcher!
  23.  
  24. display
  25.     "display my model NoteCard"
  26. self model displayAt:(self frame origin)!
  27.  
  28. displaySection
  29. "display the current Selection if any"
  30. self dispatcher isThereAnItemSelected
  31.     ifTrue: [self highlight: self dispatcher selectedItem]!
  32.  
  33. highlight: anInfoItem
  34. "reverse the color of an infoitem, a form"
  35. |rectangle |
  36. rectangle := anInfoItem reverse.
  37. rectangle displayOn: Display at: anInfoItem location.!
  38.  
  39. openOn: aNoteCard
  40.     "create a TopPane plug a NoteCard into it
  41.      and schedule it on the desktop"
  42.     |topView|
  43. topView := TopPane new.
  44. topView label: 'NoteCard View'.
  45. topView minimumSize: 300@200.
  46. topView addSubpane: (noteCardPane := NoteCardPane new
  47.                     menu: #noteCardMenu;
  48.                     model: aNoteCard).
  49. topView dispatcher open scheduleWindow!
  50.  
  51. performMenu 
  52.         "Private - If the model has a menu creation 
  53.          method defined, give it control, else ask the 
  54.          dispatcher class for the menu." 
  55.     | menu | 
  56.     (model isNil or: [paneMenuSelector isNil]) 
  57.         ifTrue: [menu := dispatcher class menu] 
  58.         ifFalse: [menu := model perform: paneMenuSelector]. 
  59.     self popUp: menu!
  60.  
  61. reframe: aRectangle 
  62.         "Reframe the receiver window 
  63.          according to aRectangle." 
  64.     self resize: aRectangle!
  65.  
  66. resize: aRectangle 
  67.         "Private - Change the size of the window 
  68.          to aRectangle." 
  69.     frame := aRectangle origin extent: 
  70.         (aRectangle extent max: 
  71.             LabelFont width * 7 + 10 @ 
  72.                 (LabelFont height * 2 + 8)).!
  73.  
  74. showWindow
  75.         "Display the receiver pane
  76.          and the selection."
  77.     self display.
  78.     self topPane dispatcher active
  79.         ifFalse: [self graySelection]!
  80.  
  81. unHighlight: anInfoItem
  82. "return to normal a deselected InfoItem"
  83. self highlight: anInfoItem! !
  84.